import request from "../utils/http";

// 获取食材列表 GET /goods
export function getGoodsList(params) {
  return request({
    url: "/goods",
    method: "get",
    params: params,
  });
}

// 获取食材分类列表  GET /goods/categories
export function getGoodsCategories() {
  return request({
    url: "/goods/categories",
    method: "get",
  });
}

// 获取供应商列表  GET /goods/suppliers
export function getGoodsSuppliers() {
  return request({
    url: "/goods/suppliers",
    method: "get",
  });
}

// 获取单个食材详情  GET /goods/:id
export function getGoodsDetail(id) {
  return request({
    url: `/goods/${id}`,
    method: "get",
  });
}

// 新增食材  POST /goods
export function addGoods(data) {
  return request({
    url: "/goods",
    method: "post",
    data: data,
  });
}

// 更新食材信息  PUT /goods/:id
export function updateGoods(id, data) {
  return request({
    url: `/goods/${id}`,
    method: "put",
    data: data,
  });
}

// 停用 (软删除) 食材 DELETE /goods/:id
export function deleteGoods(id) {
  return request({
    url: `/goods/${id}`,
    method: "delete",
  });
}
